﻿using UnityEditor;
using UnityEngine;

namespace Yoozoo.Gameplay.Liberty.VehicleController
{
    [CustomEditor(typeof(VehicleInteriorComponent))]
    [CanEditMultipleObjects]
    public class VehicleInteriorComponentEditor : UnityEditor.Editor
    {
        public override void OnInspectorGUI()
        {
            if (GUILayout.Button("找到内饰"))
            {
                if (targets != null)
                {
                    for (int i = 0; i < targets.Length; i++)
                    {
                        (targets[i] as VehicleInteriorComponent)?.FindInteriors();
                    }
                }
            }


            var t = target as VehicleInteriorComponent;
            GUILayout.BeginHorizontal();

            if (GUILayout.Button("隐藏内饰"))
            {
                t.HideInteriors();
            }

            if (GUILayout.Button("显示内饰"))
            {
                t.ShowInteriors();
            }
            
            GUILayout.EndHorizontal();
            
            base.OnInspectorGUI();
        }
    }
}